Preventing overdraw with sorting filters

In Kanzi objects are presented for rendering from top to bottom of the project tree as shown in the Kanzi Studio Project. You can change rendering of 3D objects by using filters, and for 2D objects when using Layer Render On Demand. See Using partial rendering layers.

Overdraw issues occur when one object is first drawn to an area of pixels in the back buffer, after which another object is presented that occludes the first object and the same pixels are filled again. Excessive overdraw can decrease performance on the GPU in the form of increased fill-rate. If you order objects so that the occluding object is drawn first, the occluded pixels do not have to be rendered again because of depth buffering.

You can prevent overdraw by sorting layers and 3D objects with a sorting filter into front-to-back order before rendering, and by hiding known invisible items. This adds some overhead to the CPU, because objects are ordered before drawing and updated when transformations in the scene are changed (for example, through animations).

Viewing overdraw of objects in your application

Overdraw visualization shows a lot of intensity in areas where fragments are unnecessarily rendered.

To view overdraw of objects in your Kanzi application:

Preventing overdraw using a sorting filter

To prevent overdraw using a sorting filter:

  1. In the Library right-click Composing > Pipeline and select Create > Sorting Filter.
  2. In the Properties set properties:
    • Sorting Type to View z
    • Enable the Reverse Order property
  3. In the Library > Composing > Composers select the render pass you use to render your scene.
  4. In the Properties set Object Source property to the sort filter you created in the first step of this procedure.

The default sorting filter rearranges the scene in front-to-back order. However, you can select only a part of the scene in your project. This is useful if the GPU fillrate, lighting, texturing or fragment shaders are known bottlenecks for performance. See Using tag filters.

Test the effect of ordering on the overall performance by measuring the frame rate in both cases. See Measuring the performance of your Kanzi application.

See also

Rendering best practices

Partial rendering

Optimizing rendering of layouts

Setting layers for efficient rendering

Using tag filters

Rendering static content

Rendering transparent objects

Measuring the performance of your Kanzi application

Best practices